package cn.edu.qzuie.artist.module.td.controller.app.school;

import cn.edu.qzuie.artist.framework.common.pojo.CommonResult;
import cn.edu.qzuie.artist.module.td.api.school.TdSchoolApi;
import cn.edu.qzuie.artist.module.td.api.school.dto.TdSchoolSelectRespDTO;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

import static cn.edu.qzuie.artist.framework.common.pojo.CommonResult.success;

@Tag(name = "用户 APP - TD学校")
@RestController
@RequestMapping("/td/school")
@Validated
public class AppSchoolController {
    @Resource
    private TdSchoolApi tdSchoolApi;
    @GetMapping("/getSchoolsForSelect")
    @Operation(summary = "获得学校信息")
    public CommonResult<List<TdSchoolSelectRespDTO>> getSchools(){
        List<TdSchoolSelectRespDTO> list=tdSchoolApi.getSchool();
        return success(list);
    }


    @GetMapping("/getSchoolByRegionId")
    @Operation(summary = "根据地域编号RegionId获得学校信息")
    public  CommonResult<List<TdSchoolSelectRespDTO>> getSchoolByRegionId(Long regionId){
        List<TdSchoolSelectRespDTO> list=tdSchoolApi.getSchool(regionId);
        return success(list);
    }

}
